package com.dayuanit.dy17.mix.thread;

import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolDead {
    public static void main(String[] args) {
        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(1,
                1,
                60,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(10));


        //线程不在接收新的任务，会将线程池中已经提交的任务，全部执行完毕，再退出。
        poolExecutor.shutdown();

        //让队列中木有执行的任务，直接就返回，不再处理。
        List<Runnable> runnables = poolExecutor.shutdownNow();
    }
}
